package cuiyt.juc.function;

import java.util.function.Consumer;

/**
 * @author cyt
 * @create 2020-05-02 0:01
 */
public class Consume {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder("Hello ");

        Consumer<StringBuilder> c = (str) -> {
            str.append("Jack -> ");
        };

        Consumer<StringBuilder> c2 = (str) -> {
            str.append("test !");
        };

        /**
         * 在执行完   accept的计算之后， 在开始执行 andThe中的计算
         */
         c.andThen(c2).accept(sb);
        System.out.println(sb.toString());
    }
}
